package singles

import (
	"github.com/go-resty/resty/v2"
	"showurl/static-file/kplayer/apis/config"
	httpUtils "showurl/static-file/kplayer/apis/utils/http"
)

type RespGetVersion struct {
	BuildVersion   string `json:"build_version"`
	BuildHash      string `json:"build_hash"`
	BuildSystem    string `json:"build_system"`
	BuildArch      string `json:"build_arch"`
	ConfigVersion  string `json:"config_version"`
	PluginVersion  string `json:"plugin_version"`
	LicenseVersion string `json:"license_version"`
}

func GetVersion() *RespGetVersion {
	resp := &RespGetVersion{}
	httpUtils.ParseResponseJsonBody(func(r *resty.Request) (*resty.Response, error) {
		return r.Get(config.Host + `/version`)
	}, resp)
	return resp
}

/*
{
    "build_version": "v0.4.7",
    "build_hash": "5b3dcb9",
    "build_system": "Linux",
    "build_arch": "x86_64",
    "config_version": "1.1.0",
    "plugin_version": "1.3.1",
    "license_version": "v1"
}
*/
